package com.taofuxn.yycreazy.adpater;

import android.text.TextUtils;
import android.view.View;
import android.widget.ImageView;

import com.bumptech.glide.Glide;
import com.taofuxn.yycreazy.R;
import com.taofuxn.yycreazy.adpater.base.TaofuRecyclerAdapter;
import com.taofuxn.yycreazy.adpater.base.TaofuRecyclerViewHodler;
import com.taofuxn.yycreazy.mvp.model.NewsertJokBean;

import java.util.ArrayList;

/**
 * Created by wanghuafu on 16/9/16.
 */
public class SpecialAdapter extends TaofuRecyclerAdapter<NewsertJokBean.NewsertJokResult.NewsertJok> {


    public SpecialAdapter(int layoutId, ArrayList<NewsertJokBean.NewsertJokResult.NewsertJok> mData) {
        super(layoutId,mData);
    }

    @Override
    protected void convert(TaofuRecyclerViewHodler holder, NewsertJokBean.NewsertJokResult.NewsertJok b) {
        if (!TextUtils.isEmpty(b.updatetime))
            holder.setText(R.id.updateTime,b.updatetime);
        holder.setText(R.id.content, "\t\t\t"+b.content);
        if (!TextUtils.isEmpty(b.url)){
            holder.retrieveView(R.id.itemImg).setVisibility(View.VISIBLE);
            Glide.with(holder.itemView.getContext()).load(b.url).into((ImageView) holder.retrieveView(R.id.itemImg));
        }else {
            holder.retrieveView(R.id.itemImg).setVisibility(View.GONE);
        }

    }


}
